<template>
  <ul class="Steps">
    <li @click="onStep(1)" :class="{ active: step === 1 }">Step 1</li>
    <li :class="{ active: step === 2 }">Step 2</li>
  </ul>
</template>
<script lang="ts" setup>
import { inject } from "vue";

const step = inject("step");
const onStep = (e) => {
  step.value = e;
};
</script>
<style lang="scss" scoped>
.Steps {
  height: 40px;
}
.Steps li {
  cursor: pointer;
  padding: 0px 0px 0 0;
  width: 30%;
  line-height: 40px;
  background: #d4d4d4;
  display: inline-block;
  color: #222;
  position: relative;
  float: left;
  font-size: 12px;
  //   margin-right: 5px;
  text-align: center;
}

.Steps li:after {
  content: "";
  display: block;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
  border-left: 15px solid #d4d4d4;
  position: absolute;
  right: -14px;
  top: 0;
  z-index: 10;
}
.Steps li:before {
  content: "";
  display: block;
  border-top: 20px solid #d4d4d4;
  border-bottom: 20px solid #d4d4d4;
  border-left: 15px solid #fff;
  position: absolute;
  left: 0px;
  top: 0;
}

.Steps li:first-child:before {
  display: none;
}
.Steps li.active {
  background-color: #bc1f22;
  color: #fff;
}
.Steps li.active:after {
  border-left-color: #bc1f22;
}
.Steps li.active:before {
  border-top-color: #bc1f22;
  border-bottom-color: #bc1f22;
}
</style>